package com.yanqu.road.entity.activity.shrek;

import com.yanqu.road.entity.DataObject;

import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class DouLuoShrekUserData extends DataObject {

    private int activityId;

    private long userId;

    //一共获得多少积分
    private long integral;

    //学员产生了多少个
    private int studentCount;

    //椅子的等级
    private Map<Integer,Integer> buildingLevelMap = new ConcurrentHashMap();

    //椅子的升级时间
    private Map<Integer, Map<Integer,Long>> buildingLevelUpTimeMap = new ConcurrentHashMap();

    //技能的等级
    private Map<Integer,Integer> skillLevelMap = new ConcurrentHashMap();

    //学生信息
    private Map<Integer, DouLuoShrekStudentData> studentMap = new ConcurrentHashMap();

    //学生信息
    private Map<Integer, DouLuoShrekStudentData> cacheDisappearMap = new ConcurrentHashMap();

    //毕业学生信息
    private Map<Integer, String> solderData = new ConcurrentHashMap();

    //魂师头衔id 生成多少个
    private Map<Integer, Integer> solderTitleCountMap = new ConcurrentHashMap();

    //建筑id 流失多少个
    private Map<Integer, Integer> dieCountMap = new ConcurrentHashMap();

    //上一次产生事件的时间
    private long lastEventTime;

    //学院事件，除了招生办都会有事件
    private Map<Integer, DouLuoShrekEventData> eventMap = new ConcurrentHashMap();

    private int minSolder = 0;

    private long produceTime;

    private long updateTime;

    private int bossId;

    //boss在打第几次，一开始是1，然后一直加
    private int bossKillTimes;

    private BigInteger bossBlood;


    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public long getIntegral() {
        return integral;
    }

    public void setIntegral(long integral) {
        if(integral != this.integral){
            this.integral = integral;
            setUpdateOption();
        }
    }


    public int getStudentCount() {
        return studentCount;
    }

    public void setStudentCount(int studentCount) {
        if(studentCount != this.studentCount){
            this.studentCount = studentCount;
            setUpdateOption();
        }
    }

    public Map<Integer, Integer> getBuildingLevelMap() {
        return buildingLevelMap;
    }

    public void setBuildingLevelMap(Map<Integer,Integer> buildingLevelMap) {
        this.buildingLevelMap = buildingLevelMap;
        setUpdateOption();
    }

    public Map<Integer, Integer> getSkillLevelMap() {
        return skillLevelMap;
    }

    public void setSkillLevelMap(Map<Integer, Integer> skillLevelMap) {
        this.skillLevelMap = skillLevelMap;
        setUpdateOption();
    }

    public Map<Integer, DouLuoShrekStudentData> getStudentMap() {
        return studentMap;
    }

    public void setStudentMap(Map<Integer, DouLuoShrekStudentData> studentMap) {
        this.studentMap = studentMap;
        setUpdateOption();
    }

    public Map<Integer, String> getSolderData() {
        return solderData;
    }

    public void addSolder(int solderId,String solderParam){
        if(this.minSolder == 0){
            this.minSolder = solderId;
        }
        this.solderData.put(solderId,solderParam);
        setUpdateOption();
    }

    public void setSolderData(Map<Integer, String> solderData) {
        this.solderData = solderData;
        setUpdateOption();
    }

    public long getProduceTime() {
        return produceTime;
    }

    public void setProduceTime(long produceTime) {
        if(produceTime != this.produceTime){
            this.produceTime = produceTime;
            setUpdateOption();
        }
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        if(updateTime != this.updateTime){
            this.updateTime = updateTime;
            setUpdateOption();
        }
    }


    public int getBossId() {
        return bossId;
    }

    public void setBossId(int bossId) {
        if(bossId != this.bossId){
            this.bossId = bossId;
            setUpdateOption();
        }
    }

    public BigInteger getBossBlood() {
        return bossBlood;
    }

    public void setBossBlood(BigInteger bossBlood) {
        if(!Objects.equals(this.bossBlood, bossBlood)){
            this.bossBlood = bossBlood;
            setUpdateOption();
        }
    }

    public int getBossKillTimes() {
        return bossKillTimes;
    }

    public void setBossKillTimes(int bossKillTimes) {
        if(bossKillTimes != this.bossKillTimes){
            this.bossKillTimes = bossKillTimes;
            setUpdateOption();
        }
    }

    public int getMinSolder() {
        return minSolder;
    }

    public void setMinSolder(int minSolder) {
        if(minSolder == this.minSolder){
            this.minSolder = minSolder;
            setUpdateOption();
        }
    }

    public void setMinSolder() {
        List<Integer> solderIdList = new ArrayList<>(solderData.keySet());
        Collections.sort(solderIdList);
        if(solderIdList.size() == 0){
            this.minSolder = 0;
        }else{
            this.minSolder = solderIdList.get(0);
        }
        setUpdateOption();
    }

    public Map<Integer, Integer> getSolderTitleCountMap() {
        return solderTitleCountMap;
    }

    public void setSolderTitleCountMap(Map<Integer, Integer> solderTitleCountMap) {
        this.solderTitleCountMap = solderTitleCountMap;
        setUpdateOption();
    }


    public long getLastEventTime() {
        return lastEventTime;
    }

    public void setLastEventTime(long lastEventTime) {
        if(lastEventTime != this.lastEventTime){
            this.lastEventTime = lastEventTime;
            setUpdateOption();
        }
    }

    public Map<Integer, DouLuoShrekEventData> getEventMap() {
        return eventMap;
    }

    public void setEventMap(Map<Integer, DouLuoShrekEventData> eventMap) {
        this.eventMap = eventMap;
        setUpdateOption();
    }

    public void addEvent(Integer buildingId , DouLuoShrekEventData event) {
        if(eventMap.size() == 0){
            return;
        }
        if(!eventMap.containsKey(buildingId)){
            return;
        }
        eventMap.put(buildingId,event);
        setUpdateOption();
    }

    public Map<Integer, Map<Integer, Long>> getBuildingLevelUpTimeMap() {
        return buildingLevelUpTimeMap;
    }

    public void setBuildingLevelUpTime(int buildingId,int level,long levelUpTime) {
        buildingLevelUpTimeMap.get(buildingId).put(level,levelUpTime);
        setUpdateOption();
    }

    public void setBuildingLevelUpTimeMap(Map<Integer, Map<Integer, Long>> buildingLevelUpTimeMap) {
        this.buildingLevelUpTimeMap = buildingLevelUpTimeMap;
        setUpdateOption();
    }

    public Map<Integer, DouLuoShrekStudentData> getCacheDisappearMap() {
        return cacheDisappearMap;
    }

    public void setCacheDisappearMap(Map<Integer, DouLuoShrekStudentData> cacheDisappearMap) {
        this.cacheDisappearMap = cacheDisappearMap;
        setUpdateOption();
    }


    public Map<Integer, Integer> getDieCountMap() {
        return dieCountMap;
    }

    public void setDieCountMap(Map<Integer, Integer> dieCountMap) {
        this.dieCountMap = dieCountMap;
        setUpdateOption();
    }
}
